var t = getApp(), e = t.requirejs("core"), a = t.requirejs("biz/order");
t.requirejs("foxui");
Page({
    data: {
      id: "",
      list: {},
      wm_msg:{},
      o_item:{},
      options: "",
      cancel: a.cancelArray,
    },
    onLoad: function(e) {
      var that = this;
      that.setData({
        id: e.id,
      })
      // that.getInfo();
      // that.getPeiInfo();
    },
    onShow: function() {
      this.getInfo();
      this.getPeiInfo();
      t.getCache("isIpx") ? this.setData({
          isIpx: !0,
          iphonexnavbar: "fui-iphonex-navbar",
          paddingb: "padding-b"
      }) : this.setData({
          isIpx: !1,
          iphonexnavbar: "",
          paddingb: ""
      });
    },
    getInfo: function() {
      var t = this, id = t.data.id
      e.get("merch/order/detail", {id: id}, function(res) {
        t.setData({
          show: !0,
          list: res,
        });
      });
    },
    getPeiInfo: function() {
      var t = this, id = t.data.id
      e.get("merch/order/order_pei_query", {id: id}, function(res) {
        t.setData({
          show: !0,
          wm_msg: res.wm_msg,
          o_item: res.item,
        });
      });
    },
    open: function(p) {
      var t = this, id = t.data.id;
      // var dpurl = encodeURIComponent(p.currentTarget.dataset.url);
      // wx.navigateTo({
      //   url: "/store/web/index?dp="+dpurl+"&id="+id,
      // })
      wx.navigateTo({
        url: "/pages/web/index?id="+id,
      })
    },
    call: function(p) {
      let phone = p.currentTarget.dataset.tel;
      wx.makePhoneCall({
        phoneNumber: phone,
        success:function() { console.log("成功！"); },
        fail:function() { console.log("失败！"); }
      })
    },
    cancel: function(t) {
      a.cancel(this.data.options.id, t.detail.value, "/pages/order/detail/index?id=" + this.data.options.id);
    },
    refundcancel: function(t) {
      var th = this;
      e.confirm("确定您要取消申请?", function() {
        e.post("order/refund/cancel", {
            id: th.data.id
        }, function(e) {
          if(e.error==0) {
            th.getInfo()
          }else {
            wx.showToast({
              title: "失败",
              icon: "none",
              duration: 1500
            })
          }
          
        }, !0);
    });
    },
});